#ifndef HORAIRE_H
#define HORAIRE_H
#include <QString>
#include <QUrl>
#include <QNetworkAccessManager>
#include <QObject>
#include <QNetworkReply>
#include <QRegExp>

class horaire : public QObject
{
    Q_OBJECT
public:
    horaire(QString code_timeo,QObject *parent=0);
    QString premier_passage,second_passage;

    void Get_Passage();
    void refresh_as_text(int id_l_string);

    struct passage
    {
        QString temps_restant;
        QString Direction;
    };

    struct horaire_timeo
    {
        QString Ligne;
        QString Nom_Arret;
        passage Prochain;
        passage Suivant;
    };
   struct horaire_timeo Horaire_Timeo;

private slots:
    void Erreur(QNetworkReply::NetworkError code);
    void reponse_recu(QNetworkReply *reponse);
    void Refresh();
    void extraire_horaire();

signals:
    void Ready2Refresh();
    void IsRefreshed();
    void FreshMeat();
    void SendHoraireString(QString);
    void erreur(QString);
    void Refresh_as_texte_by_id_lstring(int,QString);


private:
    void Post_It(QUrl url, QString parametres);
    void extraire_parametre_ajax();
    void extraire_passage();
    QUrl    url_principale;
    QString    params_update_ajax;
    QString     _code_timeo;
    QString     parametres_post;

    QNetworkAccessManager *manager;






    //
    QString         contenu_reponse;

    QString         param_refs;
    QString         param_ran;
    int             is_ready;
    int             id_lstring;
    QString         g_resultat;
    bool            sendIt;

};

#endif // HORAIRE_H
